Xbasic

a5wcb_graphQLQueryBuilder Function

Syntax

DIM Result as P = a5wcb_graphQLQueryBuilder(C websiteBaseURL ,C serviceName [,C authorizationType [,C queryString [,C variablesJSON [,C authorizationVariable [,L flagShowWarningOnExit ]]]]])

Arguments

websiteBaseURLCharacter

serviceNameCharacter

authorizationTypeCharacter

Default = . Can be blank (""), "header", or "queryString". Indicates if the authorizationVariable will be in the request header or the request query string.

queryStringCharacter

Default = "". If authorizationType is "queryString", queryString must specify the api key.

variablesJSONCharacter

Default = "". Query variables defined using JSON format. For example: "{\"country\":\"usa\", \"customer\": \"Alpha Software\"}"

authorizationVariableCharacter

Default = "". Name of the parameter or header that contains the api key.

flagShowWarningOnExitLogical

Default = .t.. Indicates if the dialog has Save and Cancel buttons.

Returns

ResultPointer

Returns an object with these properties:

lastbutton

OK or Cancel - indicated if user pressed the Save or Cancel button to exit the builder

query

The GraphQL query that the user defined.

vars

Any Query Variables that the user defined.

Description

Opens the GraphIQL Query Tester to define a GraphQL query.

Discussion

The a5wcb_graphQLQueryBuilder() function can be used to open the GraphIQL Query Tester window to create a GraphQL Query.

For example, assume you have defined a GraphQL service (called Northwind.a5svc) that exposes data from tables in the sample Northwind database.

To build a query, go to the Interactive window and type (pressing Enter after each line):

dim result as p
result = a5wcb_graphQLQueryBuilder("[workingpreview]","northwind")

The GraphIQL tester will open in a window. You can enter a query definition and test it. When you are done, click the Save button in the bottom right corner.

To see the query string that you defined, enter:

showvar(result.query)

To see any query variables that you defined, enter:

showvar(result.vars)

Limitations

Developer Environment and Desktop Application Only

See Also